Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ranges-push

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ranges-push

Gather string index ranges

  • 7.0.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is ranges-push?

The `ranges-push` npm package is a utility for managing and manipulating ranges of indexes. It is particularly useful for tasks that involve handling multiple ranges of text or data, such as text processing, data cleaning, or any scenario where you need to keep track of multiple index ranges.

What are ranges-push's main functionalities?

Adding Ranges

This feature allows you to add ranges to the `Ranges` instance. The `push` method takes two arguments, the start and end indexes of the range, and adds them to the list of ranges.

const { Ranges } = require('ranges-push');
const ranges = new Ranges();
ranges.push(0, 5);
ranges.push(10, 15);
console.log(ranges.current()); // [[0, 5], [10, 15]]

Merging Overlapping Ranges

This feature automatically merges overlapping ranges. When you add a new range that overlaps with an existing one, the ranges are merged into a single range.

const { Ranges } = require('ranges-push');
const ranges = new Ranges();
ranges.push(0, 5);
ranges.push(3, 10);
console.log(ranges.current()); // [[0, 10]]

Sorting Ranges

This feature ensures that the ranges are always sorted in ascending order. When you add new ranges, they are automatically placed in the correct order.

const { Ranges } = require('ranges-push');
const ranges = new Ranges();
ranges.push(10, 15);
ranges.push(0, 5);
console.log(ranges.current()); // [[0, 5], [10, 15]]

Deleting Ranges

This feature allows you to delete all ranges. The `wipe` method clears all the ranges that have been added.

const { Ranges } = require('ranges-push');
const ranges = new Ranges();
ranges.push(0, 5);
ranges.push(10, 15);
ranges.wipe();
console.log(ranges.current()); // []

Other packages similar to ranges-push

Keywords

FAQs

Package last updated on 31 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc